#ifndef MOVE
#define MOVE

struct Location
{
    int x;
    int y;
    Location(int x=0, int y=0): x(x), y(y) {
        if(!is_valid(x, y)) throw "Invalid coordinate!";
    }
    void rotate() {
        x = 8 - x;
        y = 9 - y;
    }
    bool operator==(const Location &loc) const { return x == loc.x && y == loc.y; }
    Location& operator=(const Location &loc) {
        x = loc.x;
        y = loc.y;
        return *this;
    }
    static bool is_valid(int x, int y) {
        return x >= 0 && x < 9 && y >= 0 && y < 10;
    }
};

class Move {
public:
    Move(const Location from = Location(0, 0), const Location to = Location(0, 0)): _from(from), _to(to) {}
    Location from() const { return _from; }
    Location to() const { return _to; }
    void rotate() {
        _from.rotate();
        _to.rotate();
    }
    bool operator==(const Move &m) const { return _from == m._from && _to == m._to; }
    Move& operator=(const Move &m) { 
        _from = m.from();
        _to = m.to();
        return *this;
    }
private:
    Location _from;
    Location _to;
};

#endif